package cn.itcast.nems.employee.dao.mapper;

import cn.itcast.nems.employee.dao.entity.Employee;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.List;

@Mapper
public interface EmployeeMapper extends BaseMapper<Employee> {
    @Select("select * from e2_employee where email=#{email} order by created_datetime desc limit 1")
    Employee findOneByEmail(String email) ;

    @Select("<script>select * from e2_employee where email IN <foreach collection='email' item='item' open='(' separator=',' close=')'>#{item}</foreach> order by created_datetime desc limit 1</script>")
    List<Employee> findMoreByEmail(Collection<String> email) ;
}
